package com.example.emailWeb.Socket.SimpleDemo;

import java.io.Serializable;
import java.net.Socket;

public class DataBuffer implements Serializable {
    private static final long serialVersionUID = 143100447075123L;
    //如果stop为真，就自己收下数据。不再转发给他人
    private boolean stop;
    private boolean Back;
    private boolean sendOther;
    public String fileName;
    private String msg;
    private Socket socket;
    private String fileOwner;
    private String fileRequest;
    int keyOrder;

    public DataBuffer() {
    }

    public DataBuffer(String fileOwner, String fileRequest, int keyOrder) {
        this.fileOwner = fileOwner;
        this.fileRequest = fileRequest;
        this.keyOrder = keyOrder;
    }

    public DataBuffer clonePrimaryKey(DataBuffer dataBuffer){
        return new DataBuffer(dataBuffer.fileOwner, dataBuffer.fileRequest, dataBuffer.keyOrder);
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public boolean isBack() {
        return Back;
    }

    public void setBack(boolean back) {
        Back = back;
    }

    /**
     * sendOther为真，设置socket属性
     * @return
     */
    public boolean isSendOther() {
        return sendOther;
    }

    public void setSendOther(boolean sendOther) {
        this.sendOther = sendOther;
    }

    public boolean isStop() {
        return stop;
    }

    public void setStop(boolean stop) {
        this.stop = stop;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Socket getSocket() {
        return socket;
    }

    public void setSocket(Socket socket) {
        this.socket = socket;
    }

    public String getFileOwner() {
        return fileOwner;
    }

    public void setFileOwner(String fileOwner) {
        this.fileOwner = fileOwner;
    }

    public String getFileRequest() {
        return fileRequest;
    }

    public void setFileRequest(String fileRequest) {
        this.fileRequest = fileRequest;
    }

    public int getKeyOrder() {
        return keyOrder;
    }

    public void setKeyOrder(int keyOrder) {
        this.keyOrder = keyOrder;
    }

    @Override
    public String toString() {
        return "DataBuffer{" +
                "stop=" + stop +
                ", Back=" + Back +
                ", sendOther=" + sendOther +
                ", fileName='" + fileName + '\'' +
                ", msg='" + msg + '\'' +
                ", socket=" + socket +
                ", fileOwner='" + fileOwner + '\'' +
                ", fileRequest='" + fileRequest + '\'' +
                ", keyOrder=" + keyOrder +
                '}';
    }
}
